<?php 
	$sysApps = new sysApps();
	//echo $_SESSION['user_MGM_id'];
	//echo 'fullname ='.$sysApps->userInfo($_SESSION['user_MGM_id'], 'fullname');
	
?>
<form method="post" name="frm-editprofile" action="func/save-profile.php">
<div class="account-info">
	<div class="pageTitle">Account Info</div>
    
    <div class="frm_rows">
        <div class="frm_left">MGM ID</div>
        <div class="frm_right"><INPUT name="mgm_id" type="text" class="inputTextbox" id="mgm_id" value="<?php echo $sysApps->userInfo($_SESSION['user_MGM_id'], 'user_MGM_id');?>" readonly="readonly" ></div>
    </div>
        <div class="frm_rows">
        <div class="frm_left">Sponsor ID</div>
        <div class="frm_right"><INPUT name="sponsor_id" type="text" class="inputTextbox" id="sponsor_id" value="<?php echo $sysApps->userInfo($_SESSION['user_MGM_id'], 'sponsor_id');?>" readonly="readonly" ></div>
    </div>
</div>

<div class="account-info">
            <div class="pageTitle">User Info</div>
            
            <div class="frm_rows">
            	<div class="frm_left">Full Name</div>
                <div class="frm_right"><INPUT type="text" id="fullname" name="fullname" class="inputTextbox" value="<?php echo $sysApps->userInfo($_SESSION['user_MGM_id'], 'fullname');?>"></div>
            </div>
            
            <div class="frm_rows"> 
            	<div class="frm_left">Address</div>
                <div class="frm_right"><INPUT type="text" id="address1" name="address1" class="inputTextbox" value="<?php echo $sysApps->userInfo($_SESSION['user_MGM_id'], 'address1');?>"></div>
                
            </div>
            <div class="frm_rows">
            	<div class="frm_left"></div>
                <div class="frm_right"><INPUT type="text" id="address2" name="address2" class="inputTextbox" value="<?php echo $sysApps->userInfo($_SESSION['user_MGM_id'], 'address2');?>"></div>
            </div>
                        
            <div class="frm_rows"> 
            	<div class="frm_left">State</div>
                <div class="frm_check"></div>
            	<div class="frm_right">
                <?php $state = $sysApps->userInfo($_SESSION['user_MGM_id'],'state');?>
                	<select name="state" id="state">
                        <option value="none" selected="selected">Please Select State</option>
                        <!--<option value="JOH" <?php //if($_SESSION['tmp_state']==='Johor') echo 'selected="selected"';?>>Johor</option>-->
                        <option value="JOH" <?php if($state=='JOH') echo 'selected="selected"';?>>Johor</option>
                        <option value="KED" <?php if($state=='KED') echo 'selected="selected"';?>>Kedah</option>
                        <option value="KEL" <?php if($state=='KEL') echo 'selected="selected"';?>>Kelantan</option>
                        <option value="KUL" <?php if($state=='KUL') echo 'selected="selected"';?>>Kuala Lumpur</option>
                        <option value="LAB" <?php if($state=='LAB') echo 'selected="selected"';?>>Labuan</option>
                        <option value="MEL" <?php if($state=='MEL') echo 'selected="selected"';?>>Melaka</option>
                        <option value="NS9" <?php if($state=='NS9') echo 'selected="selected"';?>>Negeri Sembilan</option>
                        <option value="PAH" <?php if($state=='PAH') echo 'selected="selected"';?>>Pahang</option>
                        <option value="PEN" <?php if($state=='PEN') echo 'selected="selected"';?>>Pulau Pinang</option>
                        <option value="PER" <?php if($state=='PER') echo 'selected="selected"';?>>Perlis</option>
                        <option value="PRK" <?php if($state=='PRK') echo 'selected="selected"';?>>Perak</option>
                        <option value="PUT" <?php if($state=='PUT') echo 'selected="selected"';?>>Putrajaya</option>
                        <option value="SBH" <?php if($state=='SBH') echo 'selected="selected"';?> >Sabah</option>
                        <option value="SRW" <?php if($state=='SRW') echo 'selected="selected"';?>>Sarawak</option>
                        <option value="SEL" <?php if($state=='SEL') echo 'selected="selected"';?>>Selangor</option>
                        <option value="TER" <?php if($state=='TER') echo 'selected="selected"';?>>Terengganu</option>
                    </select>
                </div>
            </div>
            
            <div class="frm_rows">
            	<div class="frm_left">Country</div>
            	<div class="frm_check"></div>
            	<div class="frm_right">
				<?php $country = $sysApps->userInfo($_SESSION['user_MGM_id'],'country');?>  
                	<select name="country" id="country">
                    	
                        <option value="none" selected="selected">Please Select Country</option>
                        <!--<option value="JOH" <?php //if($_SESSION['tmp_state']==='Johor') echo 'selected="selected"';?>>Johor</option>-->
                        <option value="MY" <?php if($country=='MY') echo 'selected="selected"';?>>Malaysia</option>
                        <option value="SG" <?php if($country=='SG') echo 'selected="selected"';?>>Singapura</option>
                        <option value="BRN" <?php if($country=='BRN') echo 'selected="selected"';?>>Brunei</option>
                        <option value="AUS" <?php if($country=='AUS') echo 'selected="selected"';?>>Australia</option>
                        
                    </select>
                </div>
            </div>
            
            <div class="frm_rows">
            	<div class="frm_left">Phone No</div>
                <div class="frm_right"><INPUT type="text" id="phone_no" name="phone_no" class="inputTextbox" value="<?php echo $sysApps->userInfo($_SESSION['user_MGM_id'], 'phone_no');?>"></div>
            </div>
            <div class="frm_rows">
            	<div class="frm_left">Mobile No</div>
                <div class="frm_right"><INPUT type="text" id="mobile_no" name="mobile_no" class="inputTextbox" value="<?php echo $sysApps->userInfo($_SESSION['user_MGM_id'], 'mobile_no');?>"></div>
            </div>
             <div class="frm_rows">
            	<div class="frm_left"></div>
                <div class="frm_right"><div class="smallButton">Submit</div></div>
            </div>
            <div class="frm_rows">
            	<div class="frm_left"></div>
                <div class="frm_right"><div class="notify"><div class="notify-msg">test</div></div></div>
            </div>
           
        </div>
</form>
<script>
$(document).ready(function(){
	$('.notify').hide();
	$('.smallButton').click(function(){
		
		
		var id = $('#mgm_id').val();
		var fullname = $('#fullname').val();
		var address1 = $('#address1').val(); 
		var address2 = $('#address2').val();
		var state = $('#state').val();
		var country = $('#country').val();
		var phone_no = $('#phone_no').val();
		var mobile_no = $('#mobile_no').val();
		
		var url = '<?php echo $sysApps->BASEurl();?>members/func/save-profile.php';
		alert(url);
		//return false;
		//alert(id+' + '+fullname+' + '+address1+' + '+address2+' + '+state+' + '+country+' + '+phone_no+' + '+mobile_no);
		$.post("<?php echo $sysApps->BASEurl();?>members/func/save-profile.php",{id:id, fullname:fullname, address1:address1, address2:address2, state:state, country:country, phone_no:phone_no, mobile_no:mobile_no},function(response){
			//alert(response);
			//return false;
			switch(response)
			{
			case '1':
			  $('.notify').show("slide",{direction: 'down'});
					$('.notify').delay(2000).hide("slide",{direction: 'up'});
					$('.notify-msg').removeClass("check_error").addClass("check_pass").text("Profile Has Been Saved");
					return false;	
			  break;
			
			default:
			$('.notify').show("slide",{direction: 'down'});
					$('.notify').delay(2000).hide("slide",{direction: 'up'});
					$('.notify-msg').removeClass("check_pass").addClass("check_error").text("Something went wrong, Please contact Admnistrator");
					return false;	
			  
			}
		});
	});
});
</script>
